<template>
  <div class="ant-pro-pages-account-projects-cardList">
    <a-list
      :loading="loading"
      :data-source="records"
      :grid="{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }"
    >
      <template v-slot:renderItem="{ item }">
        <a-list-item>
          <a-card class="ant-pro-pages-account-projects-card" hoverable>
            <template v-slot:cover>
              <img :src="item.picture" :alt="item.name" />
            </template>
            <a-card-meta :title="item.name">
              <template v-slot:description>
                {{ item.field }}
              </template>
            </a-card-meta>
          </a-card>
        </a-list-item>
      </template>
    </a-list>
  </div>
</template>
<script lang="ts">
import { getActivityPageOfMy } from "@/api/Qms/Activity/index";
import { defineComponent, onMounted, ref } from "vue";
export default defineComponent({
  name: "Project",
  setup() {
    const records = ref<Array<ActivityVo>>([]);
    const loading = ref(false);
    const getList = async () => {
      try {
        loading.value = true;
        const { data } = await getActivityPageOfMy();
        records.value = data.records;
      } catch (error) {
        console.log(error);
      } finally {
        loading.value = false;
      }
    };
    onMounted(() => {
      getList();
    });
    return {
      records,
      loading,
    };
  },
});
</script>

<style lang="less" scoped>
.ant-pro-pages-account-projects-cardList {
  margin-top: 24px;

  ::v-deep(.ant-card-meta-title) {
    margin-bottom: 4px;
  }

  ::v-deep(.ant-card-meta-description) {
    height: 44px;
    overflow: hidden;
    line-height: 22px;
  }

  .cardItemContent {
    display: flex;
    height: 20px;
    margin-top: 16px;
    margin-bottom: -4px;
    line-height: 20px;

    > span {
      flex: 1 1;
      color: rgba(0, 0, 0, 0.45);
      font-size: 12px;
    }

    ::v-deep(.ant-pro-avatar-list) {
      flex: 0 1 auto;
    }
  }
}
</style>
